component  output="false" persistent="true"
{    
    property name="ChangeLogID" column="ID" generator="identity";
    property name="AuthUserID" column="AuthUserID";
    property name="AuthUserRosettaID" column="AuthUserRosettaID";
    property name="ChangeDate" column="ChangeDate";
    property name="PreviousValue" column="PreviousValue";
    property name="NewValue" column="NewValue";
    property name="PageChanged" column="PageChanged";
    property name="Event" column="Event";
    property name="ADObject" column="ADObject";
    
    
    public ChangeLog function init()
    {
        return this;    
    }
    
    
    public any function addChangeLog( required string PreviousValue, required string NewValue, string Event = "", string ADObject = ""  )
    {
        import models.*;
        ChangeLog = EntityNew("ChangeLog");
        ChangeLog.setAuthUserID( cgi.AUTH_USER );
        ChangeLog.setAuthUSerRosettaID( session.myuserinfo.RosettaID );
        ChangeLog.setChangeDate( now() );
        ChangeLog.setPreviousValue( arguments.PreviousValue );
        ChangeLog.setNewValue( arguments.NewValue );
        ChangeLog.setPageChanged( CGI.HTTP_REFERER );
        ChangeLog.setEvent( arguments.Event );
        ChangeLog.setADObject( arguments.ADObject );
        EntitySave(ChangeLog, true);
        return true;
    }

}